package com.soft.service;

import com.soft.dao.PositionDaoImpl;
import com.soft.pojo.Position;
import com.soft.utils.Result;

import java.util.ArrayList;

/**
 * @author ruoxi
 * @create 2021-12-26 20:42
 */
public class PositionService {
    private PositionDaoImpl positionDao = new PositionDaoImpl();

    public ArrayList<Position> findPositionByPage(int currentPage, int currentCount) {
        return (ArrayList<Position>) positionDao.selectPositionByPage(currentPage, currentCount);
    }

    public int findPositionCount(){
        return positionDao.selectByAll().size();
    }


    public Position findPositionById(int id) {
        return positionDao.selectPositionById(id);
    }

    public Result addPosition(Position position){
        int line = positionDao.add(position);
        if (line>0){
            return Result.me().setMsg("发布成功");
        }
        return Result.me(false).setMsg("发布失败");
    }
}
